// 在这里面定义所有接口，一个文件管理所有接口，易于维护
import {http} from './http'; // 引入刚刚封装好的http模块，import属于ES6的语法，微信开发者工具必须打开ES6转ES5选项

function getCode(params){ // 获取验证码
  http('login/getCode','get',params)  // 接口请求的路由地址以及请求方法在此处传递
}
function login(params){  // 登录
  http('login/login','post',params) 
} 
function getSlider(params){ // 获取轮播
  http('data/getSlider','get',params)  
}
function getCate(params){ // 获取栏目
  http('data/getCate','get',params)  
}
function news_lists(params){ // 获取文章列表
  http('news/lists','get',params)  
}

function news_followed(params){ // 获取关注人文章列表
  http('news/followed','get',params)  
}
function news_create(params){ // 发布动态
  http('news/create','post',params)
}
function news_like(params){ // 点赞
  http('news/like','post',params,false)
}
function news_share(params){ // 分享
  http('news/share','post',params) 
}
function news_details(params){ // 文章详情
  http('news/details','get',params) 
}

function news_comment_mine(params){ // 评论我的人
  http('news/comment_mine','get',params) 
}

function message_lists(params){ // 系统通知
  http('message/lists','get',params) 
}

function news_comment_lists(params){ // 评论列表
  http('news/comment_lists','get',params) 
}

function user_getFans(params){ // 粉丝列表
  http('user/getFans','get',params) 
}

function user_official(params){ //官方账号
  http('user/official','get',params) 
}

function user_getFollow(params){ // 关注列表
  http('user/getFollow','get',params) 
}

function fans_followed(params){ // 关注
  http('fans/followed','post',params) 
}

function user_getInfo(params){ // 个人信息
  http('user/getInfo','get',params) 
}

function news_mine_lists(params){ // 获取个人文章
  http('news/mine_lists','get',params) 
}

function news_mine_like(params){ // 获取点赞的文章
  http('news/mine_like','get',params) 
}

function news_top_lists(params){ // 置顶文章
  http('news/top_lists','get',params) 
}

function data_getInfo(params){ // 轮播详情
  http('data/getInfo','get',params) 
}

function news_del(params){ // 删除文章
  http('news/del','post',params) 
}
function news_update(params){ // 修改文章
  http('news/update','post',params) 
}
function news_comment(params){ // 评论文章
  http('news/comment','post',params)  
}

function news_answer(params){ // 我的回复
  http('news/answer','get',params)  
}
function news_comment_detail(params){
  http('news/comment_detail','get',params)
}
function news_answer_list(params){ // 回复列表
  http('news/answer_list','get',params)
}

function news_comment_answer(params){ // 回复评论
  http('news/comment_answer','post',params)
}
function login_weapi(params){  // 预授权
  http('login/weapi','post',params)
}
function message_del(params){  // 删除系统消息
  http('message/del','post',params)
}
function news_comment_like(params){ // 文章评论点赞
  http('news/comment_like','post',params,false)
}
function news_answer_like(params){ // 回复点赞
  http('news/answer_like','post',params,false)
}
function user_uptime(params){ // 更新阅读时间
  http('user/uptime','post',params)
}
function get_latest(params){ // 最新发布消息时间
  http('user/get_latest','get',params,false)
}
function data_unread_num(params){ // 未读数量
  http('data/unread_num','get',params,false)
}
function data_insert_read(params){ // 批量插入已读
  http('data/insert_read','post',params,false)
}
function data_insert_row_read(params){ // 单条插入已读
  http('data/insert_row_read','post',params,false)
}
// 每一个接口定义一个函数，然后暴露出去，供逻辑代码调用
export default { // 暴露接口
  getCode,
  login,
  getSlider,
  getCate,
  news_lists,
  news_create,
  news_like,
  news_share,
  news_details,
  news_followed,
  news_comment_mine,
  message_lists,
  news_comment_lists,
  user_getFans,
  user_getFollow,
  fans_followed,
  user_getInfo,
  user_official,
  news_mine_lists,
  news_mine_like,
  news_top_lists,
  data_getInfo,
  news_del,
  news_update,
  news_comment,
  news_comment_detail,
  news_answer,
  news_answer_list,
  news_comment_answer,
  login_weapi,
  message_del,
  news_comment_like,
  news_answer_like,
  user_uptime,
  get_latest,
  data_unread_num,
  data_insert_read,
  data_insert_row_read
}